﻿package frEngine.effectEditTool.lineRoad
{
    import baseEngine.basic.*;
    import baseEngine.core.*;
    import baseEngine.system.*;
    import frEngine.pools.*;
    import frEngine.primitives.*;

    public class LineCirle extends Pivot3D
    {
        private var _pos:FrCube;
        private var _inCircle:FrSphere;
        private var _outCircle:FrSphere;
        private var _inLine:FrLine3D;
        private var _outLine:FrLine3D;

        public function LineCirle(param1)
        {
            var _loc_2:* = Global3D.scene.renderLayerList;
            super("");
            this._pos = FrObjectPool.getObject(FrCube, this, "");
            this._pos.reinit(_loc_2, 5, 5, 5, 1, param1);
            this._inCircle = FrObjectPool.getObject(FrSphere, this, "");
            this._inCircle.reinit(_loc_2, 3, 18);
            this._inCircle.setMaterial(65280, 0, "green");
            this._outCircle = FrObjectPool.getObject(FrSphere, this, "");
            this._outCircle.reinit(_loc_2, 3, 18);
            this._outCircle.setMaterial(255, 0, "blue");
            this.addChild(this._pos);
            this.addChild(this._inCircle);
            this.addChild(this._outCircle);
            this._inLine = new FrLine3D("", _loc_2);
            this._outLine = new FrLine3D("", _loc_2);
            this.addChild(this._inLine);
            this.addChild(this._outLine);
            return;
        }// end function

        public function initParent(param1:Pivot3D, param2:Object, param3:Object, param4:Object) : void
        {
            this.parent = param1;
            this._pos.setPosition(param2.x, param2.y, param2.z);
            this.addChild(this._pos);
            this.addChild(this._inCircle);
            this.addChild(this._outCircle);
            this.addChild(this._inLine);
            this.addChild(this._outLine);
            if (param3)
            {
                this._inCircle.setPosition(param3.x, param3.y, param3.z);
                var _loc_5:Boolean = false;
                this._inLine.isHide = false;
                this._inCircle.isHide = _loc_5;
                this._inLine.clear();
                this._inLine.lineStyle(1, 16711680);
                this._inLine.moveTo(param2.x, param2.y, param2.z);
                this._inLine.lineTo(param3.x, param3.y, param3.z);
            }
            else
            {
                var _loc_5:Boolean = true;
                this._inLine.isHide = true;
                this._inCircle.isHide = _loc_5;
            }
            if (param4)
            {
                this._outCircle.setPosition(param4.x, param4.y, param4.z);
                var _loc_5:Boolean = false;
                this._outLine.isHide = false;
                this._outCircle.isHide = _loc_5;
                this._outLine.clear();
                this._outLine.lineStyle(1, 16711680);
                this._outLine.moveTo(param2.x, param2.y, param2.z);
                this._outLine.lineTo(param4.x, param4.y, param4.z);
            }
            else
            {
                var _loc_5:Boolean = true;
                this._outLine.isHide = true;
                this._outCircle.isHide = _loc_5;
            }
            return;
        }// end function

        public function clear() : void
        {
            this.removeChild(this._pos);
            this.removeChild(this._inCircle);
            this.removeChild(this._outCircle);
            this.removeChild(this._inLine);
            this.removeChild(this._outLine);
            this.parent = null;
            return;
        }// end function

    }
}
